<template name="visitorInfo">
	{{#if editing}}
		{{> visitorEdit (roomInfoData)}}
	{{/if}}
	{{#if forwarding}}
		{{> visitorForward (roomInfoData)}}
	{{/if}}
	{{#if sendingTranscript}}
		{{> visitorTranscript (roomInfoData)}}
	{{/if}}
	<div class="user-view {{showDetail}}">
		<div class="about clearfix">
			{{#with user}}
				<div class="info">
					{{#if name}}
						<h2 title="{{name}}">{{name}} <i class="status-{{status}}"></i></h2>
						<p class="secondary-font-color">{{username}}</p>
					{{else}}
						<h2 title="{{username}}">{{username}} <i class="status-{{status}}"></i></h2>
					{{/if}}
					<ul>
						{{#if utc}}<li><i class="icon-clock"></i>{{userTime}} (UTC {{utc}})</li>{{/if}}
						{{#each visitorEmails}}<li><i class="icon-mail"></i> {{address}}{{#if verified}}&nbsp;<i class="icon-ok success-color"></i>{{/if}}</li> {{/each}}
						{{#each phone}}<li><i class="icon-phone"></i> {{phoneNumber}}</li> {{/each}}
						{{#if lastLogin}}<li><i class="icon-calendar"></i> {{_ "Created_at"}}: {{createdAt}}</li> {{/if}}
						{{#if lastLogin}}<li><i class="icon-calendar"></i> {{_ "Last_login"}}: {{lastLogin}}</li> {{/if}}
						{{#if ip}}<li><i class="icon-laptop"></i><span>{{ip}}</span></li>{{/if}}
						{{#if os}}<li><i class="{{osIcon}}"></i><span>{{os}}</span></li>{{/if}}
						{{#if browser}}<li><i class="{{browserIcon}}"></i><span>{{browser}}</span></li>{{/if}}
						{{#if customVisitorFields}}
							{{#each customVisitorFields}}<li><strong>{{label}}</strong>: {{value}}</li>{{/each}}
						{{/if}}
					</ul>
				</div>
			{{/with}}

			<div class="info">
				<h3>{{_ "Conversation"}}</h3>
				<ul>
					{{#with room}}
						{{#if servedBy}}<li><strong>{{_ "Agent"}}</strong>: {{servedBy.username}}</li>{{/if}}
						{{#if facebook}}<li><i class="icon-facebook"></i>{{_ "Facebook_Page"}}: {{facebook.page.name}}</li>{{/if}}
						{{#if sms}}<li><i class="i con-mobile"></i>{{_ "SMS_Enabled"}}</li>{{/if}}
						{{#if topic}}<li><strong>{{_ "Topic"}}</strong>: {{{RocketChatMarkdown topic}}}</li>{{/if}}
						{{#if tags}}<li><strong>{{_ "Tags"}}</strong>: {{joinTags}}</li>{{/if}}
						{{#if closedAt}}<li><strong>{{_ "Closed_At"}}</strong>: {{roomClosedDateTime}} <strong>{{_ "by"}}:</strong> {{roomClosedBy}}</li>{{/if}}
						{{> Template.dynamic template=customInfoTemplate data=roomDataContext}}
					{{/with}}
					{{#with department}}
						{{#if name}}<li><strong>{{_ "Department"}}</strong>: {{name}}</li>{{/if}}
					{{/with}}
					{{#if customRoomFields}}
						{{#each customRoomFields}}<li><strong>{{label}}</strong>: {{value}}</li>{{/each}}
					{{/if}}
				</ul>
			</div>

			{{#with transcriptRequest}}
				<div class="info">
					<h3>{{_ "Transcript_Request"}}</h3>
					<ul>
						{{#if requestedAt}}<li><strong>{{_ "Requested_At"}}</strong>: {{transcriptRequestedDateTime}}</li>{{/if}}
						{{#if requestedBy}}<li><strong>{{_ "Requested_By"}}</strong>: {{requestedBy.username}}</li>{{/if}}
					</ul>
				</div>
			{{/with}}
		</div>

		{{#if canSeeButtons}}
			<nav class="centered-buttons">
				{{#if canEditRoom}}
					<button class='button rc-button rc-button--secondary button-block edit-livechat'><span><i class='icon-edit'></i> {{_ "Edit"}}</span></button>
				{{/if}}

				{{#if roomOpen}}
					{{#if canCloseRoom}}
						<button class='button rc-button rc-button--secondary button-block close-livechat'><span><i class='icon-download'></i> {{_ "Close"}}</span></button>
					{{/if}}
					{{#if canForwardGuest}}
						<button class="button rc-button rc-button--secondary button-block forward-livechat"><span><i class="icon-forward"></i> {{_ "Forward"}}</span></button>
					{{/if}}
					{{#if canReturnQueue}}
						<button class="button rc-button rc-button--secondary button-block return-inquiry"><span><i class="icon-ccw"></i> {{_ "Return"}}</span></button>
					{{/if}}
				{{/if}}

				{{#if canSendTranscript}}
					<button class="button rc-button rc-button--secondary button-block send-transcript"><span><i class="icon-mail"></i> {{_ "Transcript"}}</span></button>
				{{/if}}
			</nav>
		{{/if}}

		{{> visitorNavigation .}}
	</div>
</template>
